using Company.BLL.WS.KDT;

namespace Company.BLL.KDT
{
    public partial class HangMauDich
    {
        public void TinhThue(decimal tygiaTT)
        {
            decimal dongia_TT = this._DonGiaKB*tygiaTT;
            decimal trigiaNT = this._DonGiaKB*this._SoLuong;
            //decimal trigiaTT_XNK = (dongia_TT*this._SoLuong) + (this._ASEAN_KhoanPhaiCong*tygiaTT) - (this._ASEAN_KhoanPhaiTru*tygiaTT);
            decimal trigiaTT_XNK = (dongia_TT * this._SoLuong);
            decimal tienthue_XNK = trigiaTT_XNK*this._ThueSuatXNK/100;
            decimal tienthue_TTDB = (trigiaTT_XNK + tienthue_XNK)*this._ThueSuatTTDB/100;
            decimal tienthue_GTGT = (trigiaTT_XNK + tienthue_XNK + tienthue_TTDB)*this._ThueSuatGTGT/100;
            decimal tienthukhac = this._TyLeThuKhac*trigiaTT_XNK/100;

            this._DonGiaTT = dongia_TT;
            this._TriGiaKB = trigiaNT;
            this._TriGiaTT = trigiaTT_XNK;
            this._TriGiaKB_VND = trigiaNT*tygiaTT;
            this._ThueXNK = tienthue_XNK;
            this._ThueTTDB = tienthue_TTDB;
            this._ThueGTGT = tienthue_GTGT;
            this._TriGiaThuKhac = tienthukhac;
        }

        //-----------------------------------------------------------------------------------------

        public HangMauDichInfo ExportToInfo()
        {
            HangMauDichInfo entityInfo = new HangMauDichInfo();                        
            entityInfo.SoThuTuHang = this._SoThuTuHang;
            entityInfo.MaHS = this._MaHS;
            entityInfo.MaPhu = this._MaPhu;
            entityInfo.TenHang = this._TenHang;
            entityInfo.NuocXX_ID = this._NuocXX_ID;
            entityInfo.DVT_ID = this._DVT_ID;
            entityInfo.SoLuong = this._SoLuong;            
            entityInfo.DonGiaKB = this._DonGiaKB;
            entityInfo.DonGiaTT = this._DonGiaTT;
            entityInfo.TriGiaKB = this._TriGiaKB;
            entityInfo.TriGiaTT = this._TriGiaTT;
            entityInfo.TriGiaKB_VND = this._TriGiaKB_VND;
            entityInfo.ThueSuatXNK = this._ThueSuatXNK;
            entityInfo.ThueSuatTTDB = this._ThueSuatTTDB;
            entityInfo.ThueSuatGTGT = this._ThueSuatGTGT;
            entityInfo.ThueXNK = this._ThueXNK;
            entityInfo.ThueTTDB = this._ThueTTDB;
            entityInfo.ThueGTGT = this._ThueGTGT;
            entityInfo.PhuThu = this._PhuThu;
            entityInfo.TyLeThuKhac = this._TyLeThuKhac;
            entityInfo.TriGiaThuKhac = this._TriGiaThuKhac;
            entityInfo.MienThue = this._MienThue;
            entityInfo.MA_NPL_SP = this.MaPhu;
            return entityInfo;
        }
    }
}